package com.project.action;

import java.io.IOException;

import mvc.core.BaseAction;
import mvc.core.File;
import mvc.core.Response;
import mvc.core.annotation.Mapping;
import mvc.core.log.Logger;
import mvc.core.util.Util;

@Mapping("/")
public class RootAction extends BaseAction {
	
	private Logger logger = Logger.getLogger(RootAction.class);
	
	@Mapping("/")
	public Response index() {
		logger.info("RootAction index()");
		return new Response("Hello Word!");
	}
	
	@Mapping("/favicon.ico")
	public File favicon() {
		logger.info("RootAction favicon()");
		String fileName = "favicon.ico";
		byte[] bytes = null;
		try {
			bytes = Util.getFileBytes(fileName);
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		return new File(fileName, bytes);
	}
	
}
